 <!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 16:49:08
 * @LastEditors: charles
 * @LastEditTime: 2021-08-01 14:07:33
-->
<template>
<div class="content">
  <div class="search">
  <div class="wrapper">
    <div class="form">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="手机号">
          <el-input v-model="formInline.telephone" placeholder="手机号"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit()">搜索</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
  </div>
  <div class="projects" v-show="showRentPrise">
    <div class="wrapper">
      <div class="title">报名的游学项目</div>
      <div class="project" v-for="iteam in applyQuery" :key="iteam.id">
        <div class="pic">
          <img width="100%" :src="iteam.project.figure" alt="">
        </div>
        <div class="introduce">
          <div class="name">
            <strong>{{iteam.project.name}}</strong>
          </div>
          <div class="time1">
            <strong>时间：</strong>
            {{iteam.project.beginTime | fmtDate}}~{{iteam.project.endTime | fmtDate}}</div>
          <div class="price">
            <strong>费用：</strong>{{iteam.project.projectMoney}}元
          </div>
          <div class="time2">
            <strong>报名时间：</strong>{{iteam.insertTime | fmtTime}}
          </div>
          <div class="status">
            <strong>报名状态：</strong>{{iteam.status}}
          </div>
          <div class="desc">
            <strong>简介：</strong>
            {{iteam.project.introduce}}</div>
        </div>
      </div>
    </div>
  </div>
  <div @click="toHome()" v-show="showRentPrise1" style='text-align: center;line-height:2em;'>
    暂无报名信息，<el-link type="primary">去报名</el-link>
  </div>
</div>
</template>
<script>
import { get } from '../utils/request'

export default({
  data(){
    return {
      formInline: {
          telephone: '',
      },
      applyQuery:[],
      showRentPrise:false,
      showRentPrise1:true,
    }
  },
  methods: {
    onSubmit(){
      get('/index/apply/query',this.formInline).then(res=>{
        if(res.status==200){
          this.applyQuery=res.data
          if (this.applyQuery.length!==0) {
             this.showRentPrise=true
             this.showRentPrise1=false
          }else{
            this.showRentPrise=false
            this.showRentPrise1=true
          }
        }else{
          this.$message({
            type: 'error',
            message: res.message
          })
        }
      })
    },
    toHome(){
      this.$router.push({path:'/home'})
    }
  },
  created(){
    this.onSubmit()
  }
})
</script>
<style scoped lang="scss">
.content {
  min-height:600px;
  .search{
    .wrapper{
      .form{
        width: 800px;
        margin: 0 auto;
        padding: 2em;
        text-align: center;
      }
    }
  }
  .projects{
    .wrapper{
      .title{
        font-size: 20px;
        line-height: 4em;
        border-bottom: 1px solid #f4f4f4;
      }
      .project{
        display: flex;
        border-bottom: 1px solid #f4f4f4;
        padding: 1em 0;
        cursor: pointer;
        .pic{
          width: 300px;
          height: 200px;
          overflow: hidden;
          background-color: #f4f4f4;
          border-radius: 5px;
        }
        .introduce{
          padding: 0 2em;
          flex: 1;
        }
      }
    }
  }
}
</style>
